package com.fenghuanghui.higuojian;

import android.app.Activity;
import android.app.Dialog;
import android.content.pm.ActivityInfo;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.webkit.WebViewClient;

import com.lidroid.xutils.ViewUtils;
import com.lidroid.xutils.view.annotation.ViewInject;

public class MainActivity extends Base {

    @ViewInject(R.id.webview)
    private WebView webview;

    private Dialog customDialog;

    protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.webviewfullscreen);

	ViewUtils.inject(this); // ע��view���¼�

	webview.getSettings().setDomStorageEnabled(true); // ���htmlʹ�ñ��ش洢������
	webview.getSettings().setAppCacheEnabled(true); // ͬ��
	webview.requestFocus(View.FOCUS_DOWN);
	webview.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
	webview.getSettings().setJavaScriptEnabled(true);
	webview.getSettings().setAppCacheMaxSize(1024 * 1024 * 8);
	String appCachePath = getApplicationContext().getCacheDir().getAbsolutePath();
	webview.getSettings().setAppCachePath(appCachePath);
	webview.getSettings().setAllowFileAccess(true);
	webview.setWebViewClient(new WebViewClient() {
	    public boolean shouldOverrideUrlLoading(WebView view, String url) {
		view.loadUrl(url);
		return true;
	    }
	});
	webview.getSettings().setUseWideViewPort(true);
	webview.getSettings().setLoadWithOverviewMode(true);
	webview.getSettings().setSupportZoom(true);
	webview.getSettings().setBuiltInZoomControls(true);
	webview.loadUrl("http://www.phoemix.net/app/index.aspx");
	CustomWebViewClient tempViewClient = new CustomWebViewClient(this);
	customDialog = tempViewClient.dialog;

	webview.setWebViewClient(tempViewClient);
	webview.setWebChromeClient(new WebChromeClient());
    }
}
